//
//  IMIndexViewController.m
//  IosFrameWork
//
//  Created by imaginedays on 13-4-1.
//  Copyright (c) 2013年 imagindays. All rights reserved.
//

#import "IMIndexViewController.h"
#import "GlobalTimelineViewController.h"
#import "IMJSONKitViewController.h"

@interface IMIndexViewController ()

@end

@implementation IMIndexViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"ISO";
    _dataSource = [NSArray arrayWithObjects:@"AFN",@"JSONKit",nil];
//    _dataSource = [NSMutableArray arrayWithArray:contentsArr];
   
}

#pragma mark UITableViewDelegate Method
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}

#pragma mark UITableViewDataSource Method
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_dataSource count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   static NSString *cellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
       
    }
    cell.textLabel.text = [_dataSource objectAtIndex:[indexPath row]];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //AFN
    if ([indexPath row] == 0) {
        GlobalTimelineViewController *afnController = [[GlobalTimelineViewController alloc]init];
        afnController.title = @"AFN";
        [self.navigationController pushViewController:afnController animated:YES];
        
    }
    else if ([indexPath row] == 1)
    {
        IMJSONKitViewController *jsonkitController = [[IMJSONKitViewController alloc]init];
        jsonkitController.title = @"JSONKit";
        [self.navigationController pushViewController:jsonkitController animated:YES];
    }
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
   
}

@end
